﻿@model IEnumerable<NOSDC.Pocos.Job>

<h2>Listing of jobs</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Job ID
        </th>
        <th>
            Company
        </th>
        <th>
            Position
        </th>
        <th>
            Description
        </th>
        <th>
            Date Posted
        </th>
        <th>
            Date Expires
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr class="@(item.DateExpires > DateTime.Now ? String.Empty : "inactive")">
        <td>
            <a href='@Url.Action("Edit", "Jobs", new { id = item.Id })'> @item.Id  </a>
        </td>
        <td>
            @item.Employer
        </td>
        <td>
            @item.Title
        </td>
        <td>
            @item.Description
        </td>
        <td>
            @item.DatePosted.ToLongDateString()
        </td>
        <td>
            @item.DateExpires.ToLongDateString()
        </td>
        <td>
            <a href='@Url.Action("Edit", "Jobs", new { id = item.Id })' style="float:left;padding-right:10px;">
                <img src='@Url.Content("~/Areas/Admin/Images/edit_icon.gif")' alt="Edit" title="Edit" />
            </a>

            @using (Html.BeginForm("Delete", "Jobs", new { id = item.Id }, FormMethod.Post, new { style = "float:left;" }))
            {
                <input type="image" title="Delete" alt="Delete" src='@Url.Content("~/Areas/Admin/Images/icon-deleteX-transparent.png")' onclick="return confirm('Are you sure you want to delete this job posting?');" />
            }
        </td>
    </tr>
}

</table>